<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActiveSupport::TimeWithZone</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActiveSupport::TimeWithZone</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/rails/activesupport/lib/active_support/time_with_zone_rb.html">
                vendor/rails/activesupport/lib/active_support/time_with_zone.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
A Time-like class that can represent a <a
href="TimeWithZone.html#M000734">time</a> in any <a
href="TimeWithZone.html#M000734">time</a> <a
href="TimeWithZone.html#M000752">zone</a>. Necessary because standard Ruby
Time instances are limited to UTC and the system&#8216;s
<tt>ENV[&#8216;TZ&#8217;]</tt> <a
href="TimeWithZone.html#M000752">zone</a>.
</p>
<p>
You shouldn&#8216;t ever need to create a <a
href="TimeWithZone.html">TimeWithZone</a> instance directly via <tt><a
href="TimeWithZone.html#M000733">new</a></tt> &#8212; instead, <a
href="../Rails.html">Rails</a> provides the methods <tt>local</tt>,
<tt>parse</tt>, <tt>at</tt> and <tt>now</tt> on <a
href="TimeZone.html">TimeZone</a> instances, and <tt><a
href="TimeWithZone.html#M000741">in_time_zone</a></tt> on Time and <a
href="../DateTime.html">DateTime</a> instances, for a more user-friendly
syntax. Examples:
</p>
<pre>
  Time.zone = 'Eastern Time (US &amp; Canada)'        # =&gt; 'Eastern Time (US &amp; Canada)'
  Time.zone.local(2007, 2, 10, 15, 30, 45)        # =&gt; Sat, 10 Feb 2007 15:30:45 EST -05:00
  Time.zone.parse('2007-02-01 15:30:45')          # =&gt; Sat, 10 Feb 2007 15:30:45 EST -05:00
  Time.zone.at(1170361845)                        # =&gt; Sat, 10 Feb 2007 15:30:45 EST -05:00
  Time.zone.now                                   # =&gt; Sun, 18 May 2008 13:07:55 EDT -04:00
  Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone  # =&gt; Sat, 10 Feb 2007 15:30:45 EST -05:00
</pre>
<p>
See <a href="TimeZone.html">TimeZone</a> and <a
href="CoreExtensions/Time/Zones.html">ActiveSupport::CoreExtensions::Time::Zones</a>
for further documentation for these methods.
</p>
<p>
<a href="TimeWithZone.html">TimeWithZone</a> instances implement the same
API as Ruby Time instances, so that Time and <a
href="TimeWithZone.html">TimeWithZone</a> instances are interchangable.
Examples:
</p>
<pre>
  t = Time.zone.now                     # =&gt; Sun, 18 May 2008 13:27:25 EDT -04:00
  t.hour                                # =&gt; 13
  t.dst?                                # =&gt; true
  t.utc_offset                          # =&gt; -14400
  t.zone                                # =&gt; &quot;EDT&quot;
  t.to_s(:rfc822)                       # =&gt; &quot;Sun, 18 May 2008 13:27:25 -0400&quot;
  t + 1.day                             # =&gt; Mon, 19 May 2008 13:27:25 EDT -04:00
  t.beginning_of_year                   # =&gt; Tue, 01 Jan 2008 00:00:00 EST -05:00
  t &gt; Time.utc(1999)                    # =&gt; true
  t.is_a?(Time)                         # =&gt; true
  t.is_a?(ActiveSupport::TimeWithZone)  # =&gt; true
</pre>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000769">+</a>&nbsp;&nbsp;
      <a href="#M000770">-</a>&nbsp;&nbsp;
      <a href="#M000763">&lt;=&gt;</a>&nbsp;&nbsp;
      <a href="#M000782">acts_like_time?</a>&nbsp;&nbsp;
      <a href="#M000773">advance</a>&nbsp;&nbsp;
      <a href="#M000772">ago</a>&nbsp;&nbsp;
      <a href="#M000764">between?</a>&nbsp;&nbsp;
      <a href="#M000736">comparable_time</a>&nbsp;&nbsp;
      <a href="#M000744">dst?</a>&nbsp;&nbsp;
      <a href="#M000768">eql?</a>&nbsp;&nbsp;
      <a href="#M000751">formatted_offset</a>&nbsp;&nbsp;
      <a href="#M000785">freeze</a>&nbsp;&nbsp;
      <a href="#M000767">future?</a>&nbsp;&nbsp;
      <a href="#M000737">getgm</a>&nbsp;&nbsp;
      <a href="#M000743">getlocal</a>&nbsp;&nbsp;
      <a href="#M000738">getutc</a>&nbsp;&nbsp;
      <a href="#M000747">gmt?</a>&nbsp;&nbsp;
      <a href="#M000749">gmt_offset</a>&nbsp;&nbsp;
      <a href="#M000739">gmtime</a>&nbsp;&nbsp;
      <a href="#M000750">gmtoff</a>&nbsp;&nbsp;
      <a href="#M000778">hash</a>&nbsp;&nbsp;
      <a href="#M000758">httpdate</a>&nbsp;&nbsp;
      <a href="#M000741">in_time_zone</a>&nbsp;&nbsp;
      <a href="#M000753">inspect</a>&nbsp;&nbsp;
      <a href="#M000783">is_a?</a>&nbsp;&nbsp;
      <a href="#M000745">isdst</a>&nbsp;&nbsp;
      <a href="#M000755">iso8601</a>&nbsp;&nbsp;
      <a href="#M000784">kind_of?</a>&nbsp;&nbsp;
      <a href="#M000742">localtime</a>&nbsp;&nbsp;
      <a href="#M000786">marshal_dump</a>&nbsp;&nbsp;
      <a href="#M000787">marshal_load</a>&nbsp;&nbsp;
      <a href="#M000789">method_missing</a>&nbsp;&nbsp;
      <a href="#M000733">new</a>&nbsp;&nbsp;
      <a href="#M000765">past?</a>&nbsp;&nbsp;
      <a href="#M000740">period</a>&nbsp;&nbsp;
      <a href="#M000788">respond_to?</a>&nbsp;&nbsp;
      <a href="#M000759">rfc2822</a>&nbsp;&nbsp;
      <a href="#M000760">rfc822</a>&nbsp;&nbsp;
      <a href="#M000771">since</a>&nbsp;&nbsp;
      <a href="#M000762">strftime</a>&nbsp;&nbsp;
      <a href="#M000734">time</a>&nbsp;&nbsp;
      <a href="#M000775">to_a</a>&nbsp;&nbsp;
      <a href="#M000781">to_datetime</a>&nbsp;&nbsp;
      <a href="#M000776">to_f</a>&nbsp;&nbsp;
      <a href="#M000777">to_i</a>&nbsp;&nbsp;
      <a href="#M000756">to_json</a>&nbsp;&nbsp;
      <a href="#M000761">to_s</a>&nbsp;&nbsp;
      <a href="#M000780">to_time</a>&nbsp;&nbsp;
      <a href="#M000757">to_yaml</a>&nbsp;&nbsp;
      <a href="#M000766">today?</a>&nbsp;&nbsp;
      <a href="#M000779">tv_sec</a>&nbsp;&nbsp;
      <a href="#M000774">usec</a>&nbsp;&nbsp;
      <a href="#M000735">utc</a>&nbsp;&nbsp;
      <a href="#M000746">utc?</a>&nbsp;&nbsp;
      <a href="#M000748">utc_offset</a>&nbsp;&nbsp;
      <a href="#M000754">xmlschema</a>&nbsp;&nbsp;
      <a href="#M000752">zone</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name">Comparable</span>
      </div>
    </div>

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">time_zone</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000733" class="method-detail">
        <a name="M000733"></a>

        <div class="method-heading">
          <a href="#M000733" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(utc_time, time_zone, local_time = nil, period = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000733-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000733-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 36</span>
36:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">utc_time</span>, <span class="ruby-identifier">time_zone</span>, <span class="ruby-identifier">local_time</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">period</span> = <span class="ruby-keyword kw">nil</span>)
37:       <span class="ruby-ivar">@utc</span>, <span class="ruby-ivar">@time_zone</span>, <span class="ruby-ivar">@time</span> = <span class="ruby-identifier">utc_time</span>, <span class="ruby-identifier">time_zone</span>, <span class="ruby-identifier">local_time</span>
38:       <span class="ruby-ivar">@period</span> = <span class="ruby-ivar">@utc</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">period</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">get_period_and_ensure_valid_local_time</span>
39:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000769" class="method-detail">
        <a name="M000769"></a>

        <div class="method-heading">
          <a href="#M000769" class="method-signature">
          <span class="method-name">+</span><span class="method-args">(other)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000769-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000769-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 190</span>
190:     <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">other</span>)
191:       <span class="ruby-comment cmt"># If we're adding a Duration of variable length (i.e., years, months, days), move forward from #time,</span>
192:       <span class="ruby-comment cmt"># otherwise move forward from #utc, for accuracy when moving across DST boundaries</span>
193:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">duration_of_variable_length?</span>(<span class="ruby-identifier">other</span>)
194:         <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">:+</span>, <span class="ruby-identifier">other</span>)
195:       <span class="ruby-keyword kw">else</span>
196:         <span class="ruby-identifier">result</span> = <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">acts_like?</span>(<span class="ruby-identifier">:date</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">since</span>(<span class="ruby-identifier">other</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">utc</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">other</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">since</span>(<span class="ruby-identifier">other</span>)
197:         <span class="ruby-identifier">result</span>.<span class="ruby-identifier">in_time_zone</span>(<span class="ruby-identifier">time_zone</span>)
198:       <span class="ruby-keyword kw">end</span>
199:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000770" class="method-detail">
        <a name="M000770"></a>

        <div class="method-heading">
          <a href="#M000770" class="method-signature">
          <span class="method-name">-</span><span class="method-args">(other)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000770-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000770-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 201</span>
201:     <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">other</span>)
202:       <span class="ruby-comment cmt"># If we're subtracting a Duration of variable length (i.e., years, months, days), move backwards from #time,</span>
203:       <span class="ruby-comment cmt"># otherwise move backwards #utc, for accuracy when moving across DST boundaries</span>
204:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">acts_like?</span>(<span class="ruby-identifier">:time</span>)
205:         <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">to_f</span>
206:       <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">duration_of_variable_length?</span>(<span class="ruby-identifier">other</span>)
207:         <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">:-</span>, <span class="ruby-identifier">other</span>)
208:       <span class="ruby-keyword kw">else</span>
209:         <span class="ruby-identifier">result</span> = <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">acts_like?</span>(<span class="ruby-identifier">:date</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">ago</span>(<span class="ruby-identifier">other</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">utc</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">other</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">ago</span>(<span class="ruby-identifier">other</span>)
210:         <span class="ruby-identifier">result</span>.<span class="ruby-identifier">in_time_zone</span>(<span class="ruby-identifier">time_zone</span>)
211:       <span class="ruby-keyword kw">end</span>
212:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000763" class="method-detail">
        <a name="M000763"></a>

        <div class="method-heading">
          <a href="#M000763" class="method-signature">
          <span class="method-name">&lt;=&gt;</span><span class="method-args">(other)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Use the <a href="TimeWithZone.html#M000734">time</a> in UTC for
comparisons.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000763-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000763-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 166</span>
166:     <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">other</span>)
167:       <span class="ruby-identifier">utc</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">other</span>
168:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000782" class="method-detail">
        <a name="M000782"></a>

        <div class="method-heading">
          <a href="#M000782" class="method-signature">
          <span class="method-name">acts_like_time?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
So that <tt>self</tt> <tt>acts_like?(:<a
href="TimeWithZone.html#M000734">time</a>)</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000782-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000782-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 275</span>
275:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">acts_like_time?</span>
276:       <span class="ruby-keyword kw">true</span>
277:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000773" class="method-detail">
        <a name="M000773"></a>

        <div class="method-heading">
          <a href="#M000773" class="method-signature">
          <span class="method-name">advance</span><span class="method-args">(options)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000773-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000773-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 228</span>
228:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">advance</span>(<span class="ruby-identifier">options</span>)
229:       <span class="ruby-comment cmt"># If we're advancing a value of variable length (i.e., years, weeks, months, days), advance from #time,</span>
230:       <span class="ruby-comment cmt"># otherwise advance from #utc, for accuracy when moving across DST boundaries</span>
231:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">detect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">:years</span>, <span class="ruby-identifier">:weeks</span>, <span class="ruby-identifier">:months</span>, <span class="ruby-identifier">:days</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">k</span>}
232:         <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">:advance</span>, <span class="ruby-identifier">options</span>)
233:       <span class="ruby-keyword kw">else</span>
234:         <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">advance</span>(<span class="ruby-identifier">options</span>).<span class="ruby-identifier">in_time_zone</span>(<span class="ruby-identifier">time_zone</span>)
235:       <span class="ruby-keyword kw">end</span>
236:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000772" class="method-detail">
        <a name="M000772"></a>

        <div class="method-heading">
          <a href="#M000772" class="method-signature">
          <span class="method-name">ago</span><span class="method-args">(other)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000772-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000772-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 224</span>
224:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ago</span>(<span class="ruby-identifier">other</span>)
225:       <span class="ruby-identifier">since</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">other</span>)
226:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000764" class="method-detail">
        <a name="M000764"></a>

        <div class="method-heading">
          <a href="#M000764" class="method-signature">
          <span class="method-name">between?</span><span class="method-args">(min, max)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000764-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000764-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 170</span>
170:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">between?</span>(<span class="ruby-identifier">min</span>, <span class="ruby-identifier">max</span>)
171:       <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-identifier">min</span>, <span class="ruby-identifier">max</span>)
172:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000736" class="method-detail">
        <a name="M000736"></a>

        <div class="method-heading">
          <span class="method-name">comparable_time</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000735">utc</a>
</p>
        </div>
      </div>

      <div id="method-M000744" class="method-detail">
        <a name="M000744"></a>

        <div class="method-heading">
          <a href="#M000744" class="method-signature">
          <span class="method-name">dst?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000744-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000744-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 72</span>
72:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dst?</span>
73:       <span class="ruby-identifier">period</span>.<span class="ruby-identifier">dst?</span>
74:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000768" class="method-detail">
        <a name="M000768"></a>

        <div class="method-heading">
          <a href="#M000768" class="method-signature">
          <span class="method-name">eql?</span><span class="method-args">(other)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000768-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000768-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 186</span>
186:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">other</span>)
187:       <span class="ruby-identifier">utc</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>
188:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000751" class="method-detail">
        <a name="M000751"></a>

        <div class="method-heading">
          <a href="#M000751" class="method-signature">
          <span class="method-name">formatted_offset</span><span class="method-args">(colon = true, alternate_utc_string = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000751-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000751-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 88</span>
88:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">formatted_offset</span>(<span class="ruby-identifier">colon</span> = <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">alternate_utc_string</span> = <span class="ruby-keyword kw">nil</span>)
89:       <span class="ruby-identifier">utc?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">alternate_utc_string</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">utc_offset</span>.<span class="ruby-identifier">to_utc_offset_s</span>(<span class="ruby-identifier">colon</span>)
90:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000785" class="method-detail">
        <a name="M000785"></a>

        <div class="method-heading">
          <a href="#M000785" class="method-signature">
          <span class="method-name">freeze</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000785-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000785-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 285</span>
285:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">freeze</span>
286:       <span class="ruby-identifier">period</span>; <span class="ruby-identifier">utc</span>; <span class="ruby-identifier">time</span> <span class="ruby-comment cmt"># preload instance variables before freezing</span>
287:       <span class="ruby-keyword kw">super</span>
288:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000767" class="method-detail">
        <a name="M000767"></a>

        <div class="method-heading">
          <a href="#M000767" class="method-signature">
          <span class="method-name">future?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000767-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000767-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 182</span>
182:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">future?</span>
183:       <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">future?</span>
184:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000737" class="method-detail">
        <a name="M000737"></a>

        <div class="method-heading">
          <span class="method-name">getgm</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000735">utc</a>
</p>
        </div>
      </div>

      <div id="method-M000743" class="method-detail">
        <a name="M000743"></a>

        <div class="method-heading">
          <span class="method-name">getlocal</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000742">localtime</a>
</p>
        </div>
      </div>

      <div id="method-M000738" class="method-detail">
        <a name="M000738"></a>

        <div class="method-heading">
          <span class="method-name">getutc</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000735">utc</a>
</p>
        </div>
      </div>

      <div id="method-M000747" class="method-detail">
        <a name="M000747"></a>

        <div class="method-heading">
          <span class="method-name">gmt?</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000735">utc</a>?
</p>
        </div>
      </div>

      <div id="method-M000749" class="method-detail">
        <a name="M000749"></a>

        <div class="method-heading">
          <span class="method-name">gmt_offset</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000748">utc_offset</a>
</p>
        </div>
      </div>

      <div id="method-M000739" class="method-detail">
        <a name="M000739"></a>

        <div class="method-heading">
          <span class="method-name">gmtime</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000735">utc</a>
</p>
        </div>
      </div>

      <div id="method-M000750" class="method-detail">
        <a name="M000750"></a>

        <div class="method-heading">
          <span class="method-name">gmtoff</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000748">utc_offset</a>
</p>
        </div>
      </div>

      <div id="method-M000778" class="method-detail">
        <a name="M000778"></a>

        <div class="method-heading">
          <span class="method-name">hash</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000777">to_i</a>
</p>
        </div>
      </div>

      <div id="method-M000758" class="method-detail">
        <a name="M000758"></a>

        <div class="method-heading">
          <a href="#M000758" class="method-signature">
          <span class="method-name">httpdate</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000758-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000758-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 138</span>
138:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">httpdate</span>
139:       <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">httpdate</span>
140:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000741" class="method-detail">
        <a name="M000741"></a>

        <div class="method-heading">
          <a href="#M000741" class="method-signature">
          <span class="method-name">in_time_zone</span><span class="method-args">(new_zone = ::Time.zone)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the simultaneous <a href="TimeWithZone.html#M000734">time</a> in
<tt>Time.zone</tt>, or the specified <a
href="TimeWithZone.html#M000752">zone</a>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000741-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000741-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 61</span>
61:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">in_time_zone</span>(<span class="ruby-identifier">new_zone</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span>)
62:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">time_zone</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">new_zone</span>
63:       <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">in_time_zone</span>(<span class="ruby-identifier">new_zone</span>)
64:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000753" class="method-detail">
        <a name="M000753"></a>

        <div class="method-heading">
          <a href="#M000753" class="method-signature">
          <span class="method-name">inspect</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000753-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000753-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 97</span>
97:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
98:       <span class="ruby-node">&quot;#{time.strftime('%a, %d %b %Y %H:%M:%S')} #{zone} #{formatted_offset}&quot;</span>
99:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000783" class="method-detail">
        <a name="M000783"></a>

        <div class="method-heading">
          <a href="#M000783" class="method-signature">
          <span class="method-name">is_a?</span><span class="method-args">(klass)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Say we&#8216;re a Time to thwart type checking.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000783-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000783-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 280</span>
280:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_a?</span>(<span class="ruby-identifier">klass</span>)
281:       <span class="ruby-identifier">klass</span> <span class="ruby-operator">==</span> <span class="ruby-operator">::</span><span class="ruby-constant">Time</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">super</span>
282:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000745" class="method-detail">
        <a name="M000745"></a>

        <div class="method-heading">
          <span class="method-name">isdst</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for dst?
</p>
        </div>
      </div>

      <div id="method-M000755" class="method-detail">
        <a name="M000755"></a>

        <div class="method-heading">
          <span class="method-name">iso8601</span><span class="method-args">(fraction_digits = 0)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000754">xmlschema</a>
</p>
        </div>
      </div>

      <div id="method-M000784" class="method-detail">
        <a name="M000784"></a>

        <div class="method-heading">
          <span class="method-name">kind_of?</span><span class="method-args">(klass)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for is_a?
</p>
        </div>
      </div>

      <div id="method-M000742" class="method-detail">
        <a name="M000742"></a>

        <div class="method-heading">
          <a href="#M000742" class="method-signature">
          <span class="method-name">localtime</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns a <tt>Time.local()</tt> instance of the simultaneous <a
href="TimeWithZone.html#M000734">time</a> in your system&#8216;s
<tt>ENV[&#8216;TZ&#8217;]</tt> <a href="TimeWithZone.html#M000752">zone</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000742-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000742-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 67</span>
67:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">localtime</span>
68:       <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">getlocal</span>
69:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000786" class="method-detail">
        <a name="M000786"></a>

        <div class="method-heading">
          <a href="#M000786" class="method-signature">
          <span class="method-name">marshal_dump</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000786-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000786-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 290</span>
290:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshal_dump</span>
291:       [<span class="ruby-identifier">utc</span>, <span class="ruby-identifier">time_zone</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">time</span>]
292:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000787" class="method-detail">
        <a name="M000787"></a>

        <div class="method-heading">
          <a href="#M000787" class="method-signature">
          <span class="method-name">marshal_load</span><span class="method-args">(variables)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000787-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000787-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 294</span>
294:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshal_load</span>(<span class="ruby-identifier">variables</span>)
295:       <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">variables</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">utc</span>, <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">:get_zone</span>, <span class="ruby-identifier">variables</span>[<span class="ruby-value">1</span>]), <span class="ruby-identifier">variables</span>[<span class="ruby-value">2</span>].<span class="ruby-identifier">utc</span>)
296:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000789" class="method-detail">
        <a name="M000789"></a>

        <div class="method-heading">
          <a href="#M000789" class="method-signature">
          <span class="method-name">method_missing</span><span class="method-args">(sym, *args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Send the missing method to <tt><a
href="TimeWithZone.html#M000734">time</a></tt> instance, and wrap result in
a <a href="TimeWithZone.html#M000733">new</a> <a
href="TimeWithZone.html">TimeWithZone</a> with the existing
<tt>time_zone</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000789-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000789-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 306</span>
306:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
307:       <span class="ruby-identifier">result</span> = <span class="ruby-identifier">time</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
308:       <span class="ruby-identifier">result</span>.<span class="ruby-identifier">acts_like?</span>(<span class="ruby-identifier">:time</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">time_zone</span>, <span class="ruby-identifier">result</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">result</span>
309:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000765" class="method-detail">
        <a name="M000765"></a>

        <div class="method-heading">
          <a href="#M000765" class="method-signature">
          <span class="method-name">past?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000765-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000765-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 174</span>
174:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">past?</span>
175:       <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">past?</span>
176:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000740" class="method-detail">
        <a name="M000740"></a>

        <div class="method-heading">
          <a href="#M000740" class="method-signature">
          <span class="method-name">period</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the underlying <a
href="../TZInfo/TimezonePeriod.html">TZInfo::TimezonePeriod</a>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000740-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000740-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 56</span>
56:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">period</span>
57:       <span class="ruby-ivar">@period</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">time_zone</span>.<span class="ruby-identifier">period_for_utc</span>(<span class="ruby-ivar">@utc</span>)
58:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000788" class="method-detail">
        <a name="M000788"></a>

        <div class="method-heading">
          <a href="#M000788" class="method-signature">
          <span class="method-name">respond_to?</span><span class="method-args">(sym, include_priv = false)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Ensure proxy class responds to all methods that underlying <a
href="TimeWithZone.html#M000734">time</a> instance responds to.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000788-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000788-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 299</span>
299:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-identifier">include_priv</span> = <span class="ruby-keyword kw">false</span>)
300:       <span class="ruby-comment cmt"># consistently respond false to acts_like?(:date), regardless of whether #time is a Time or DateTime</span>
301:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'acts_like_date?'</span>
302:       <span class="ruby-keyword kw">super</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">time</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-identifier">include_priv</span>)
303:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000759" class="method-detail">
        <a name="M000759"></a>

        <div class="method-heading">
          <a href="#M000759" class="method-signature">
          <span class="method-name">rfc2822</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000759-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000759-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 142</span>
142:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rfc2822</span>
143:       <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">:rfc822</span>)
144:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000760" class="method-detail">
        <a name="M000760"></a>

        <div class="method-heading">
          <span class="method-name">rfc822</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000759">rfc2822</a>
</p>
        </div>
      </div>

      <div id="method-M000771" class="method-detail">
        <a name="M000771"></a>

        <div class="method-heading">
          <a href="#M000771" class="method-signature">
          <span class="method-name">since</span><span class="method-args">(other)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000771-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000771-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 214</span>
214:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">since</span>(<span class="ruby-identifier">other</span>)
215:       <span class="ruby-comment cmt"># If we're adding a Duration of variable length (i.e., years, months, days), move forward from #time,</span>
216:       <span class="ruby-comment cmt"># otherwise move forward from #utc, for accuracy when moving across DST boundaries</span>
217:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">duration_of_variable_length?</span>(<span class="ruby-identifier">other</span>)
218:         <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">:since</span>, <span class="ruby-identifier">other</span>)
219:       <span class="ruby-keyword kw">else</span>
220:         <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">since</span>(<span class="ruby-identifier">other</span>).<span class="ruby-identifier">in_time_zone</span>(<span class="ruby-identifier">time_zone</span>)
221:       <span class="ruby-keyword kw">end</span>
222:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000762" class="method-detail">
        <a name="M000762"></a>

        <div class="method-heading">
          <a href="#M000762" class="method-signature">
          <span class="method-name">strftime</span><span class="method-args">(format)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Replaces <tt>%Z</tt> and <tt>%z</tt> directives with <tt><a
href="TimeWithZone.html#M000752">zone</a></tt> and <tt><a
href="TimeWithZone.html#M000751">formatted_offset</a></tt>, respectively,
before passing to Time#strftime, so that <a
href="TimeWithZone.html#M000752">zone</a> information is correct
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000762-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000762-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 160</span>
160:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>)
161:       <span class="ruby-identifier">format</span> = <span class="ruby-identifier">format</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'%Z'</span>, <span class="ruby-identifier">zone</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'%z'</span>, <span class="ruby-identifier">formatted_offset</span>(<span class="ruby-keyword kw">false</span>))
162:       <span class="ruby-identifier">time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>)
163:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000734" class="method-detail">
        <a name="M000734"></a>

        <div class="method-heading">
          <a href="#M000734" class="method-signature">
          <span class="method-name">time</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns a Time or <a href="../DateTime.html">DateTime</a> instance that
represents the <a href="TimeWithZone.html#M000734">time</a> in
<tt>time_zone</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000734-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000734-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 42</span>
42:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">time</span>
43:       <span class="ruby-ivar">@time</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">period</span>.<span class="ruby-identifier">to_local</span>(<span class="ruby-ivar">@utc</span>)
44:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000775" class="method-detail">
        <a name="M000775"></a>

        <div class="method-heading">
          <a href="#M000775" class="method-signature">
          <span class="method-name">to_a</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000775-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000775-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 251</span>
251:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_a</span>
252:       [<span class="ruby-identifier">time</span>.<span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time</span>.<span class="ruby-identifier">min</span>, <span class="ruby-identifier">time</span>.<span class="ruby-identifier">hour</span>, <span class="ruby-identifier">time</span>.<span class="ruby-identifier">day</span>, <span class="ruby-identifier">time</span>.<span class="ruby-identifier">mon</span>, <span class="ruby-identifier">time</span>.<span class="ruby-identifier">year</span>, <span class="ruby-identifier">time</span>.<span class="ruby-identifier">wday</span>, <span class="ruby-identifier">time</span>.<span class="ruby-identifier">yday</span>, <span class="ruby-identifier">dst?</span>, <span class="ruby-identifier">zone</span>]
253:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000781" class="method-detail">
        <a name="M000781"></a>

        <div class="method-heading">
          <a href="#M000781" class="method-signature">
          <span class="method-name">to_datetime</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000781-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000781-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 270</span>
270:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_datetime</span>
271:       <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">to_datetime</span>.<span class="ruby-identifier">new_offset</span>(<span class="ruby-constant">Rational</span>(<span class="ruby-identifier">utc_offset</span>, <span class="ruby-value">86_400</span>))
272:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000776" class="method-detail">
        <a name="M000776"></a>

        <div class="method-heading">
          <a href="#M000776" class="method-signature">
          <span class="method-name">to_f</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000776-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000776-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 255</span>
255:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_f</span>
256:       <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">to_f</span>
257:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000777" class="method-detail">
        <a name="M000777"></a>

        <div class="method-heading">
          <a href="#M000777" class="method-signature">
          <span class="method-name">to_i</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000777-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000777-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 259</span>
259:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_i</span>
260:       <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">to_i</span>
261:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000756" class="method-detail">
        <a name="M000756"></a>

        <div class="method-heading">
          <a href="#M000756" class="method-signature">
          <span class="method-name">to_json</span><span class="method-args">(options = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns a <a href="JSON.html">JSON</a> string representing the <a
href="TimeWithZone.html">TimeWithZone</a>. If
ActiveSupport.use_standard_json_time_format is set to true, the ISO 8601
format is used.
</p>
<h4>Examples:</h4>
<pre>
  # With ActiveSupport.use_standard_json_time_format = true
  Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
  # =&gt; &quot;2005-02-01T15:15:10Z&quot;

  # With ActiveSupport.use_standard_json_time_format = false
  Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
  # =&gt; &quot;2005/02/01 15:15:10 +0000&quot;
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000756-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000756-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 122</span>
122:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_json</span>(<span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
123:       <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ActiveSupport</span>.<span class="ruby-identifier">use_standard_json_time_format</span>
124:         <span class="ruby-identifier">xmlschema</span>.<span class="ruby-identifier">inspect</span>
125:       <span class="ruby-keyword kw">else</span>
126:         <span class="ruby-node">%(&quot;#{time.strftime(&quot;%Y/%m/%d %H:%M:%S&quot;)} #{formatted_offset(false)}&quot;)</span>
127:       <span class="ruby-keyword kw">end</span>
128:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000761" class="method-detail">
        <a name="M000761"></a>

        <div class="method-heading">
          <a href="#M000761" class="method-signature">
          <span class="method-name">to_s</span><span class="method-args">(format = :default)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
<tt>:db</tt> format outputs <a href="TimeWithZone.html#M000734">time</a> in
UTC; all others output <a href="TimeWithZone.html#M000734">time</a> in
local. Uses <a href="TimeWithZone.html">TimeWithZone</a>&#8216;s <tt><a
href="TimeWithZone.html#M000762">strftime</a></tt>, so <tt>%Z</tt> and
<tt>%z</tt> work correctly.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000761-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000761-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 149</span>
149:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">format</span> = <span class="ruby-identifier">:default</span>)
150:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">format</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">format</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:db</span>
151:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">formatter</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Time</span><span class="ruby-operator">::</span><span class="ruby-constant">DATE_FORMATS</span>[<span class="ruby-identifier">format</span>]
152:         <span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:call</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">formatter</span>)
153:       <span class="ruby-keyword kw">else</span>
154:         <span class="ruby-node">&quot;#{time.strftime(&quot;%Y-%m-%d %H:%M:%S&quot;)} #{formatted_offset(false, 'UTC')}&quot;</span> <span class="ruby-comment cmt"># mimicking Ruby 1.9 Time#to_s format</span>
155:       <span class="ruby-keyword kw">end</span>
156:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000780" class="method-detail">
        <a name="M000780"></a>

        <div class="method-heading">
          <a href="#M000780" class="method-signature">
          <span class="method-name">to_time</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
A <a href="TimeWithZone.html">TimeWithZone</a> acts like a Time, so just
return <tt>self</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000780-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000780-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 266</span>
266:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_time</span>
267:       <span class="ruby-keyword kw">self</span>
268:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000757" class="method-detail">
        <a name="M000757"></a>

        <div class="method-heading">
          <a href="#M000757" class="method-signature">
          <span class="method-name">to_yaml</span><span class="method-args">(options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000757-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000757-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 130</span>
130:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_yaml</span>(<span class="ruby-identifier">options</span> = {})
131:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-constant">Emitter</span>)
132:         <span class="ruby-identifier">utc</span>.<span class="ruby-identifier">to_yaml</span>(<span class="ruby-identifier">options</span>)
133:       <span class="ruby-keyword kw">else</span>
134:         <span class="ruby-identifier">time</span>.<span class="ruby-identifier">to_yaml</span>(<span class="ruby-identifier">options</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'Z'</span>, <span class="ruby-identifier">formatted_offset</span>(<span class="ruby-keyword kw">true</span>, <span class="ruby-value str">'Z'</span>))
135:       <span class="ruby-keyword kw">end</span>
136:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000766" class="method-detail">
        <a name="M000766"></a>

        <div class="method-heading">
          <a href="#M000766" class="method-signature">
          <span class="method-name">today?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000766-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000766-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 178</span>
178:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">today?</span>
179:       <span class="ruby-identifier">time</span>.<span class="ruby-identifier">today?</span>
180:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000779" class="method-detail">
        <a name="M000779"></a>

        <div class="method-heading">
          <span class="method-name">tv_sec</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="TimeWithZone.html#M000777">to_i</a>
</p>
        </div>
      </div>

      <div id="method-M000774" class="method-detail">
        <a name="M000774"></a>

        <div class="method-heading">
          <a href="#M000774" class="method-signature">
          <span class="method-name">usec</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000774-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000774-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 247</span>
247:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">usec</span>
248:       <span class="ruby-identifier">time</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:usec</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">time</span>.<span class="ruby-identifier">usec</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
249:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000735" class="method-detail">
        <a name="M000735"></a>

        <div class="method-heading">
          <a href="#M000735" class="method-signature">
          <span class="method-name">utc</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns a Time or <a href="../DateTime.html">DateTime</a> instance that
represents the <a href="TimeWithZone.html#M000734">time</a> in UTC.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000735-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000735-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 47</span>
47:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">utc</span>
48:       <span class="ruby-ivar">@utc</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">period</span>.<span class="ruby-identifier">to_utc</span>(<span class="ruby-ivar">@time</span>)
49:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000746" class="method-detail">
        <a name="M000746"></a>

        <div class="method-heading">
          <a href="#M000746" class="method-signature">
          <span class="method-name">utc?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000746-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000746-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 77</span>
77:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">utc?</span>
78:       <span class="ruby-identifier">time_zone</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTC'</span>
79:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000748" class="method-detail">
        <a name="M000748"></a>

        <div class="method-heading">
          <a href="#M000748" class="method-signature">
          <span class="method-name">utc_offset</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000748-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000748-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 82</span>
82:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">utc_offset</span>
83:       <span class="ruby-identifier">period</span>.<span class="ruby-identifier">utc_total_offset</span>
84:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000754" class="method-detail">
        <a name="M000754"></a>

        <div class="method-heading">
          <a href="#M000754" class="method-signature">
          <span class="method-name">xmlschema</span><span class="method-args">(fraction_digits = 0)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000754-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000754-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 101</span>
101:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xmlschema</span>(<span class="ruby-identifier">fraction_digits</span> = <span class="ruby-value">0</span>)
102:       <span class="ruby-identifier">fraction</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fraction_digits</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
103:         <span class="ruby-value str">&quot;.%i&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">time</span>.<span class="ruby-identifier">usec</span>.<span class="ruby-identifier">to_s</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">fraction_digits</span>]
104:       <span class="ruby-keyword kw">end</span>
105: 
106:       <span class="ruby-node">&quot;#{time.strftime(&quot;%Y-%m-%dT%H:%M:%S&quot;)}#{fraction}#{formatted_offset(true, 'Z')}&quot;</span>
107:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000752" class="method-detail">
        <a name="M000752"></a>

        <div class="method-heading">
          <a href="#M000752" class="method-signature">
          <span class="method-name">zone</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Time uses <tt><a href="TimeWithZone.html#M000752">zone</a></tt> to display
the <a href="TimeWithZone.html#M000734">time</a> <a
href="TimeWithZone.html#M000752">zone</a> abbreviation, so we&#8216;re
duck-typing it.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000752-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000752-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/time_with_zone.rb, line 93</span>
93:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">zone</span>
94:       <span class="ruby-identifier">period</span>.<span class="ruby-identifier">zone_identifier</span>.<span class="ruby-identifier">to_s</span>
95:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>